import dayjs from 'dayjs'
export function formatMonthDay(date, format = 'MM月DD日') {
  return dayjs(date).format(format)
}
// 计算差异天数
export function getDiffDate(startDate, endDate) {
  const date1 = dayjs(endDate)
  return date1.diff(startDate, 'day')
}

// 根据时间计算是对应的星期几
export function formatWeek(dataString, isWeek = false) {
  let date = new Date(dataString);
  if (isWeek) {
    const week = date.getDay()
    const weekList = ["日", "一", "二", "三", "四", "五", "六"]
    // isWeek为true 代表计算周几
    return "周" + weekList[week]; //getDay会根据一个时间，返回一个具体日期中一周的第几天,0是星期日
  }
  return `${date.getMonth() + 1}月${date.getDate()}日`;
}




